import 'package:get/get.dart';
import 'package:get/get_state_manager/src/simple/get_controllers.dart';
import '../../../../../bean/KeyValueBean.dart';
class ChargebackDialogPageController extends GetxController {
  RxList<KeyValueBean> list_gz = <KeyValueBean>[].obs;
  RxString content= ''.obs;

  int  select_index=-1;
ChargebackDialogPageController() {
    initData();
  }

  void initData() {
    list_gz.add(KeyValueBean.keyValue(key: "北京", value: "联系不上", ui_select_view_data: 0));
    // list_gz.add(KeyValueBean("上海", "需求不平", 0));
    // list_gz.add(KeyValueBean("青岛", "其他原因", 0));
  }

  void clearData() {
    list_gz.forEach((v) {
      v.ui_select_view_data = 0;
    });
    list_gz.refresh();
  }

  void updateBean(int idnex){
     if(-1==select_index){
       select_index=idnex;
       list_gz[select_index].ui_select_view_data=1;
     }else{
       list_gz[select_index].ui_select_view_data=0;
       select_index=idnex;
       list_gz[select_index].ui_select_view_data=1;
     }
     list_gz.refresh();
  }

  KeyValueBean select() {
    KeyValueBean selectedList1 =
        list_gz.where((v) => v.ui_select_view_data == 1).first;
    return selectedList1;
  }
}
